<?php
namespace Home\Controller\Mobile;
use Home\Controller\Mobile\BasicController;

class IndexController extends BasicController {
	
	public function index(){
		$cid = I('request.cid');
		//分类
		$project_class = M('sxkj_offline_project_class')->order('update_time desc')->select();
		if(empty($cid)){
			$cid = $project_class[0]['id'];
		}
		//搜索词
		$searchval = I('request.searchval');
		if(!empty($searchval)){
			$par['title'] = array('like','%'.$searchval.'%');
			$this->assign('searchval',$searchval);
		}
		//$par['cid'] = $cid;
		$par['status'] = 1;
		$list = M('sxkj_offline_project')->where($par)->order('id desc')->select();
		
		//系统设置
		$par['flag'] = 'system';
		$system = M('sxkj_offline_data')->where($par)->find();
		$system = json_decode($system['data'],true);
		
		$banner = M('sxkj_offline_banner')->where(array())->order('id desc')->select();
		
		$this->assign('banner',$banner);
		$this->assign('system',$system);
		$this->assign('cid',$cid);
		$this->assign('list',$list);
		$this->assign('project_class',$project_class);
		$this->display();
	}
 	
}